package br.com.loja.view.swing.form;

import br.com.loja.model.entity.despesa.Despesa;
import br.com.loja.mvp.presenter.IEntityPresenter;

/**
 * @brief Classe DespesaForm
 * @author David Luiz
 * @date 05/12/2014
 */
@FormEntity(Despesa.class)
public class DespesaForm extends AbstractFormEntity<Despesa> {

    private javax.swing.JComboBox cbxIntervalo;
    private javax.swing.JLabel lblDescricao;
    private javax.swing.JLabel lblDiaVencimento;
    private javax.swing.JLabel lblIdDespesa;
    private javax.swing.JLabel lblIntervalo;
    private javax.swing.JLabel lblValor;
    private javax.swing.JTextField txtDescricao;
    private javax.swing.JTextField txtDiaVencimento;
    private javax.swing.JTextField txtIdDespesa;
    private javax.swing.JTextField txtValor;

    public DespesaForm(IEntityPresenter<Despesa> presenter) {
        super(presenter);
        initComponents();
        setAttributesComponents();
    }

    private void initComponents() {

        java.awt.GridBagConstraints gridBagConstraints;

        lblIdDespesa = new javax.swing.JLabel();
        txtIdDespesa = new javax.swing.JTextField();
        txtIdDespesa.setName("txtIdDespesa");
        lblDescricao = new javax.swing.JLabel();
        txtDescricao = new javax.swing.JTextField();
        txtDescricao.setName("txtDescricao");
        lblValor = new javax.swing.JLabel();
        txtValor = new javax.swing.JTextField();
        txtValor.setName("txtValor");
        lblDiaVencimento = new javax.swing.JLabel();
        txtDiaVencimento = new javax.swing.JTextField();
        txtDiaVencimento.setName("txtDiaVencimento");
        lblIntervalo = new javax.swing.JLabel();
        cbxIntervalo = new javax.swing.JComboBox();
        cbxIntervalo.setName("cbxIntervalo");

        setBackground(new java.awt.Color(255, 255, 255));
        setBorder(javax.swing.BorderFactory.createEtchedBorder());
        setLayout(new java.awt.GridBagLayout());

        lblIdDespesa.setText(presenter.getLanguage().getString("code"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(8, 8, 0, 0);
        add(lblIdDespesa, gridBagConstraints);

        txtIdDespesa.setEnabled(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.ipadx = 88;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 8, 0, 0);
        add(txtIdDespesa, gridBagConstraints);

        lblDescricao.setText(presenter.getLanguage().getString("description"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(8, 6, 0, 0);
        add(lblDescricao, gridBagConstraints);

        txtDescricao.setEnabled(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.ipadx = 305;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 10);
        add(txtDescricao, gridBagConstraints);

        lblValor.setText(presenter.getLanguage().getString("value"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 8, 0, 0);
        add(lblValor, gridBagConstraints);

        txtValor.setEnabled(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.ipadx = 88;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 8, 8, 0);
        add(txtValor, gridBagConstraints);

        lblDiaVencimento.setText(presenter.getLanguage().getString("expiration"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblDiaVencimento, gridBagConstraints);

        txtDiaVencimento.setEnabled(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.ipadx = 82;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 8, 0);
        add(txtDiaVencimento, gridBagConstraints);

        lblIntervalo.setText(presenter.getLanguage().getString("period"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 5;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblIntervalo, gridBagConstraints);

        cbxIntervalo.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"ITEM 1", "ITEM 2", "ITEM 3"}));
        cbxIntervalo.setEnabled(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 5;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.ipadx = 153;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(7, 6, 0, 10);
        add(cbxIntervalo, gridBagConstraints);

    }

    private void setAttributesComponents() {
        attributeComponents.put("idDespesa", txtIdDespesa);
        attributeComponents.put("descricao", txtDescricao);
        attributeComponents.put("diaVencimento", txtDiaVencimento);
        attributeComponents.put("valor", txtValor);
    }

}